Properties
A property of an object is a characteristic that has a single value, such as the name of a window or the modification date of a file. Properties are contained by objects in much the same way that elements are (see "Element Classes" on page 16). The main difference is that each of an object's properties has only one value, whereas an object may have many different elements of a single class.Properties of an object are distinguished from each other by their unique labels. For example, the script that follows sets the Position property of the file MyFile, causing the icon for that file to move to the specified position.
tell application "Finder" set position of file "MyFile" to {29, 235} end tellThe file in this example must be located on the desktop. A file can have only one Position property, distinguished from the other properties of the file by its label,position
.The Properties section of an object class definition lists all the property labels defined for that object and describes how to use them, including the class used for each property's value and whether or not the property can be modified. Some objects inherit some or all their properties from other related objects. For example, the definition for File that begins on page 60 lists several properties that are inherited from the object class Item and several that are defined specifically for class File.
This script gets a list of the names of the files at the top level of the startup disk:
- IMPORTANT
- A property name has no plural form, even if you use it to refer to more than one property.
![]()
tell application "Finder" name of files in startup disk end tellIf you replacename
withname
s, the script won't compile.